﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace NewStart
{
    class TilesHelper
    {
        public static void AddTile(TileInfo tile)
        {
            try
            {
                CycleForm.m.flowLayoutPanel1.Controls.Add(new Tile(tile.largetile, tile.name, tile.path));
                ReloadLayout();
            }
            catch { }
        }

        public static void AddTile(string name, string path)
        {
            try
            {
                CycleForm.m.flowLayoutPanel1.Controls.Add(new Tile(false, name, path));
                ReloadLayout();
            }
            catch { }
        }

        public static void RemoveTile(Control control)
        {
            try
            {
                CycleForm.m.flowLayoutPanel1.Controls.Remove(control);
                ReloadLayout();
            }
            catch { }
        }

        public static void ReloadLayout()
        {
            CycleForm.m.flowLayoutPanel1.ResumeLayout(true);
            CycleForm.m.flowLayoutPanel1.SuspendLayout();
        }
    }
}
